<template>
  <div>
    <div class="container">
      <!-- 面包屑 -->
      <el-breadcrumb separator-class="el-icon-arrow-right">
        <el-breadcrumb-item :to="{ path: '/hotel' }">
          <span class="iconfont jiudain">&#xe612;</span>酒店
        </el-breadcrumb-item>
        <el-breadcrumb-item :to="{ path: '/hotel' }">{{cityName.replace('市','')}}酒店</el-breadcrumb-item>
        <el-breadcrumb-item>{{dataList.name}}</el-breadcrumb-item>
      </el-breadcrumb>
      <!-- 头部信息 -->
      <div class="info">
        <h2>{{ dataList.name }}</h2>
        <p>{{ dataList.alias }}</p>
        <p>
          <i class="iconfont">&#xe611;</i>
          {{ dataList.address }}
        </p>
      </div>
      <!-- 图片 -->
      <div class="moreimg">
        <div class="left">
          <img :src="imgs[current].src" alt />
        </div>
        <div class="right">
          <img
            v-for="(item, index) in imgs"
            :key="index"
            :src="item.src"
            @click="current = index"
          />
        </div>
      </div>
      <!-- 房型 -->
      <div class="information">
        <el-row type="flex" class="row-bg1" justify="space-around">
          <el-col :span="8">
            <div class="source grid-content bg-purple">价格来源</div>
          </el-col>
          <el-col :span="8">
            <div class="lowprice grid-content bg-purple-light">低价房型</div>
          </el-col>
          <el-col :span="8">
            <div class="maxlow grid-content bg-purple">最低价格/每晚</div>
          </el-col>
        </el-row>

        <el-row
          type="flex"
          class="row-bg"
          justify="space-around"
          v-for="(item, index) in products"
          :key="index"
        >
          <el-col :span="8">
            <a href="https://hotels.ctrip.com/hotel/694679.html">
              <div class="source grid-content bg-purple">{{ item.name }}</div>
            </a>
          </el-col>
          <el-col :span="8">
            <a href="https://hotels.ctrip.com/hotel/694679.html">
              <div class="lowprice grid-content bg-purple-light">
                {{ item.bestType }}
              </div>
            </a>
          </el-col>
          <el-col :span="8">
            <a href="https://hotels.ctrip.com/hotel/694679.html">
              <div class="grid">￥{{ item.price }} <span>起</span> ></div>
            </a>
          </el-col>
        </el-row>
      </div>
      <!-- 房型end -->
      <!-- 地图 -->
      <client-only>
        <detailmap />
      </client-only>
      <!-- 地图end -->
      <!-- 酒店信息 -->
      <div class="hotel_infomation">
        <el-row class="info_row">
          <el-col :span="4" class="info_col" style="color:#000"
            >基本信息</el-col
          >
          <el-col :span="20" class="info_col">
            <el-row>
              <el-col :span="6" style="padding-left: 5px; padding-right: 5px;"
                >入住时间: 14:00之后</el-col
              >
              <el-col :span="6" style="padding-left: 5px; padding-right: 5px;"
                >离店时间: 12:00之前</el-col
              >
              <el-col :span="6" style="padding-left: 5px; padding-right: 5px;"
                >{{ creation_time }} / {{ renovat_time }}</el-col
              >
              <el-col :span="6" style="padding-left: 5px; padding-right: 5px;"
                >酒店规模: {{ roomCount }}间客房</el-col
              >
            </el-row>
          </el-col>
        </el-row>
        <el-row class="info_row">
          <el-col :span="4" class="info_col" style="color:#000"
            >主要设施</el-col
          >
          <el-col :span="20" class="info_col">
            <el-row class="info_col_row" v-if="hotelassets.length">
              <span
                class="info_tag"
                v-for="(item, index) in hotelassets"
                :key="index"
                >{{ item.name }}</span
              >
            </el-row>
            <el-row class="info_col_row" v-else>
              <span>—</span>
            </el-row>
          </el-col>
        </el-row>
        <el-row class="info_row">
          <el-col :span="4" class="info_col" style="color:#000"
            >停车服务</el-col
          >
          <el-col :span="20" class="info_col">
            <el-row>—</el-row>
          </el-col>
        </el-row>
        <el-row class="info_row">
          <el-col :span="4" class="info_col" style="color:#000"
            >品牌信息</el-col
          >
          <el-col :span="20" class="info_col">
            <el-row v-if="hotelbrand != null">{{ hotelbrand.name }}</el-row>
            <el-row v-else>—</el-row>
          </el-col>
        </el-row>
      </div>
      <!-- 酒店信息end -->
      <!-- 评分系 -->
      <div class="comment">
        <h3>{{ all_remarks }}条真实用户评论</h3>
        <!-- 写到这里了 -->
        <div class="box">
          <el-row type="flex">
            <el-col :span="5">
              <el-row>总评数 ：{{ all_remarks }}</el-row>
              <el-row>好评数 ：{{ good_remarks }}</el-row>
              <el-row>差评数 ：{{ bad_remarks }}</el-row>
            </el-col>
            <el-col class="score" :span="6">
              <el-row>
                <el-rate
                  v-model="scorevalue"
                  disabled
                  show-score
                  text-color="#ff9900"
                  :score-template="`${scorevalue}分`"
                ></el-rate>
                <div class="recommend">推荐</div>
              </el-row>
            </el-col>
            <el-col :span="3">
              <div class="item">
                <!-- -->
                <div class="position">
                  <div class="flex">
                    <span>环境</span>
                    <span>{{ scores.environment }}</span>
                  </div>
                  <svg
                    id="svgForStroke"
                    :style="`stroke-dasharray: ${scores.environment * 20}% `"
                    xmlns="http://www.w3.org/2000/svg"
                  >
                    <circle cx="50%" cy="50%" r="32%" stroke-width="2%" />
                  </svg>
                </div>
              </div>
            </el-col>
            <el-col :span="3">
              <div class="item">
                <!-- -->
                <div class="position">
                  <div class="flex">
                    <span>生产</span>
                    <span>{{ scores.product }}</span>
                  </div>
                  <svg
                    id="svgForStroke"
                    :style="`stroke-dasharray: ${scores.product * 20}% `"
                    xmlns="http://www.w3.org/2000/svg"
                  >
                    <circle cx="50%" cy="50%" r="32%" stroke-width="2%" />
                  </svg>
                </div>
              </div>
            </el-col>
            <el-col :span="3">
              <div class="item">
                <!-- -->
                <div class="position">
                  <div class="flex">
                    <span>服务</span>
                    <span>{{ scores.service }}</span>
                  </div>
                  <svg
                    id="svgForStroke"
                    :style="`stroke-dasharray: ${scores.service * 20}% `"
                    xmlns="http://www.w3.org/2000/svg"
                  >
                    <circle cx="50%" cy="50%" r="32%" stroke-width="2%" />
                  </svg>
                </div>
              </div>
            </el-col>
          </el-row>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import detailmap from "@/components/hotel/map.vue";
export default {
  components: {
    detailmap
  },
  data() {
    return {
      scorevalue: 0, // 总评分
      activeName: "first",
      current: 0,
      imgs: [
        { src: "http://157.122.54.189:9093/images/hotel-pics/1.jpeg" },
        { src: "http://157.122.54.189:9093/images/hotel-pics/2.jpeg" },
        { src: "http://157.122.54.189:9093/images/hotel-pics/3.jpeg" },
        { src: "http://157.122.54.189:9093/images/hotel-pics/4.jpeg" },
        { src: "http://157.122.54.189:9093/images/hotel-pics/5.jpeg" },
        { src: "http://157.122.54.189:9093/images/hotel-pics/6.jpeg" }
      ],
      dataList: [],
      products: [],
      scores: [], // 环境评分
      //评数
      all_remarks: "", //总评
      good_remarks: "", //好评
      bad_remarks: "", //差评
      // 装修时间
      creation_time: [], //开业
      renovat_time: [], //装修
      hotelassets: [], // 主要设施
      roomCount: [], //房间数
      hotelbrand: [], //品牌名,
      cityName:''
    };
  },
  created() {
    const id = this.$route.query.id;
    this.$axios({
      url: "/hotels?id=" + id
      // method: "GET",
    }).then(res => {
      const { data } = res.data;
      console.log('1111')
      console.log(res.data);
      this.cityName = data[0].city.name
      this.dataList = data[0];
      this.scorevalue = data[0].stars;
      this.products = data[0].products;
      this.scores = data[0].scores;
      this.hotelassets = data[0].hotelassets;
      this.all_remarks = data[0].all_remarks;
      this.creation_time = data[0].creation_time;
      this.renovat_time = data[0].renovat_time;
      this.roomCount = data[0].roomCount;
      this.good_remarks = data[0].good_remarks;
      this.bad_remarks = data[0].bad_remarks;
      this.hotelbrand = data[0].hotelbrand;
      console.log(this.hotelbrand);
    });
  }
};
</script>
<style lang="less" scoped>
#svgForStroke {
  position: absolute;
  top: 0;
  left: 0;
  width: 140px;
  height: 140px;

  stroke-dashoffset: 0%;
  stroke: #ff9900;
  fill: none;
  -webkit-transform: rotate(-90deg);
  -moz-transform: rotate(-90deg);
  -ms-transform: rotate(-90deg);
  -o-transform: rotate(-90deg);
  transform: rotate(-90deg);
}
.jiudain {
  color: #0d3f70;
  margin-right: 5px;
}
.container {
  min-width: 1000px;
  width: 1000px;
  margin: 0 auto;
  // height: 2000px;
  // background: pink;
  padding-top: 20px;
}
.info {
  margin-top: 20px;
  h2 {
    font-weight: 400;
  }
  p {
    font-size: 14px;
    color: #666666;
  }
}
.moreimg {
  height: 420px;
  display: flex;
  align-items: center;
  .left {
    width: 640px;
    height: 360px;
    background: orange;
    margin-right: 30px;
    img {
      width: 100%;
      height: 360px;
      object-fit: cover;
      box-shadow: 2px 3px 3px 1px #a1a1a1;
    }
  }
  .right {
    margin-top: 8px;
    flex: 1;
    height: 370px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    img {
      width: 160px;
      object-fit: cover;
      margin-bottom: 10px;
      box-shadow: 2px 3px 3px 1px #a1a1a1;
    }
  }
}

.map {
  height: 360px;
  // background: red;
  margin: 50px 0;
  display: flex;
  .left {
    flex: 1;
    #container {
      width: 100%;
      height: 100%;
    }
  }
  .right {
    width: 350px;
    // background: orange;
    padding-left: 20px;
    .item {
      cursor: pointer;
      display: flex;
      justify-content: space-between;
      font-size: 14px;
      color: #666;
      align-items: center;
      height: 40px;
    }
  }
}
.roominfo {
  & > .el-row {
    padding: 0 10px;
    border-bottom: 1px solid #ddd;
    height: 60px;
    display: flex;
    align-items: center;
    font-size: 14px;
    &:first-child {
      .el-row {
        .el-col {
          color: #666;
        }
      }
    }
  }
}
.comment {
  margin-top: 40px;
  margin-bottom: 40px;
  h3 {
    font-size: 16px;
    margin-bottom: 20px;
  }
  .el-col {
    color: #666;
  }
  .score {
    display: flex;
    align-items: center;
    position: relative;
    .recommend {
      width: 70px;
      height: 70px;
      font-size: 24px;
      color: #ff9900;
      opacity: 0.3;
      border: 1px solid #ff9900;
      border-radius: 50%;
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%) rotate(-45deg);
      display: flex;
      justify-content: center;
      align-items: center;
    }
  }
  .item {
    width: 70px;
    height: 70px;
    position: relative;
    align-items: center;
    border-color: transparent #ff9900 #ff9900 #ff9900;
    .position {
      position: relative;
      margin-bottom: -40px;
    }
    .flex {
      width: 140px;
      height: 140px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-direction: column;
      color: #ff9900;
      position: absolute;
      left: 0;
      top: 0;
    }
  }
}
/deep/ .el-tabs__content {
  padding-right: 20px;
  height: 306px;
  overflow: auto;
  position: relative;
}
// 房型样式
.information {
  width: 100%;
  font-size: 14px;
  color: #666;
}

.row-bg1 {
  font-weight: 700;
  border-bottom: 1px solid #ccc;
  padding-bottom: 15px;
}
.row-bg {
  font-size: 14px;
  padding-bottom: 15px;
  padding-top: 15px;
  &:hover {
    background: #f5f7fa;
  }
}
.row-bg {
  font-weight: 300;
  border-bottom: 1px solid #ccc;
  span {
    color: #666;
  }
}
.source {
  margin-left: 15px;
}
.lowprice {
  text-align: center;
}
.maxlow,
.grid {
  float: right;
  padding-right: 50px;
}
.grid {
  color: coral;
}
// 酒店信息样式
.hotel_infomation {
  margin: 40px 0;
  font-size: 14px;
  .info_row {
    border-bottom: 1px solid #ededed;
    .info_col {
      height: 59px;
      padding: 20px 10px;
      color: #666;
      .info_col_row {
        margin-top: -5px;
        .info_tag {
          margin-right: 10px;
          padding: 4px 10px;
          border: 1px solid #eee;
          border-radius: 4px;
          font-size: 14px;
          color: #666;
          height: 28px;
          line-height: 28px;
          text-align: center;
          background-color: #eee;
        }
      }
    }
  }
}
</style>
